package com.bestcem.xm.ticket.dao.mapper;

import com.bestcem.xm.ticket.entity.mysql.NotificationDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 问卷项目的通知方式记录表 mapper
 *
 * @author zhangfeng <feng.zhang@idiaoyan.com>
 * @version 通知提醒新增微信公众号需求
 * @date 2021/9/17 15:46
 */
@Mapper
public interface NotificationDaoMapper {

    @Select("select * from `ds_ticket_notification` where `survey_id` = #{surveyId, jdbcType=BINARY} limit 1")
    NotificationDO findBySurveyId(String surveyId);

    @Select("select * from `ds_ticket_notification` where `survey_id` is not null")
    List<NotificationDO> findBySurveyNotNull();

    NotificationDO findByNotificationId(String notificationId);

    int insert(NotificationDO entity);

    /**
     * 根据问卷id更新通知
     *
     * @author zhangfeng
     * @date 2022/4/7 12:16 XiaoYunSong 通知提醒新增微信公众号需求 新增 是否开启免打扰/是否开启微信公众号通知
     */
    int updateBySurveyId(NotificationDO entity);
}
